package com.chenyue.cm.error.service.impl;


import com.chenyue.cm.base.service.BaseServiceImpl;
import com.chenyue.cm.error.dao.SysErrorRecordMapper;
import com.chenyue.cm.error.domain.SysErrorRecord;
import com.chenyue.cm.error.service.SysErrorRecordService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
*
* @author LBX
*/
@Service(value = "SysErrorRecordService")
public class SysErrorRecordServiceImpl extends BaseServiceImpl<SysErrorRecord>  implements SysErrorRecordService {

    private final SysErrorRecordMapper sysErrorRecordMapper;

	public SysErrorRecordServiceImpl(@Qualifier("sysErrorRecordMapper") SysErrorRecordMapper sysErrorRecordMapper) {
		this.sysErrorRecordMapper = sysErrorRecordMapper;
	}

	@Override
	public void saveErrorRecord(String title, String result) {
		SysErrorRecord record = new SysErrorRecord();
		record.setRemoteResult(result);
		record.setTitle(title);
		sysErrorRecordMapper.insert(record);
	}

	@Override
	public void saveErrorRecord(String title, String param, String result) {
		SysErrorRecord record = new SysErrorRecord();
		record.setRemoteResult(result);
		record.setTitle(title);
		record.setRequestParam(param);
		sysErrorRecordMapper.insert(record);
	}

	@Override
	public void saveErrorRecord(String title, String param, String result, int userId) {
		SysErrorRecord record = new SysErrorRecord();
		record.setRemoteResult(result);
		record.setTitle(title);
		record.setRequestParam(param);
		record.setUserId(userId);
		sysErrorRecordMapper.insert(record);
	}

	@Override
	public void saveErrorRecord(String title, String param, String result, int userId, String remark) {
		SysErrorRecord record = new SysErrorRecord();
		record.setRemoteResult(result);
		record.setTitle(title);
		record.setRequestParam(param);
		record.setUserId(userId);
		record.setRemark(remark);
		sysErrorRecordMapper.insert(record);
	}
}
